#ifndef MAZEGAME_H
#define MAZEGAME_H

#include <QCheckBox>

#include <QList>

#include <QPalette>
#include <QColor>

#include <QDebug>

#include <QFile>
#include <QTextStream>

#include <QKeyEvent>

#include "games/basegame.h"

// MazeGame: try to go to the end of the maze
class MazeGame : public BaseGame
{
    Q_OBJECT
    
public:
    // Constructor
    explicit MazeGame(QWidget *parent = 0, int difflvl = 1);

    // Members
    bool isSolved() { if( int_map[y_pos][x_pos] == 2 ) return true; return false; }
    QString hint() { return "Watch out for the Minotaur."; }

    void loadMap(QString url);
    void mapParseError(int i);
    void setValue(int row, int col, int value);
    int symbolToInt(const QChar c);
    QPalette getPalette(int i);

    void keyPressEvent(QKeyEvent *key_event);
    void focusOutEvent(QFocusEvent *) { setFocus(); }
public slots:
    void moveTo(int row, int col);
    void moveUp();
    void moveDown();
    void moveLeft();
    void moveRight();
    void takeAction();
    
private:
    bool inverted_commands;

    int n_rows;
    int n_cols;

    int x_pos;
    int y_pos;

    int start_x;
    int start_y;

    QList<int> teleport_x_locations;
    QList<int> teleport_y_locations;
    int teleport_x_arrival;
    int teleport_y_arrival;

    int number_of_keys;

    QCheckBox ***check_map;
    int **int_map;
};

#endif // MAZEGAME_H
